package com.example.newcalculator1;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class MySqliteHelper extends SQLiteOpenHelper{
    private static final int DB_VERSION = 1;//数据库版本
    private static final String DB_NAME = "myTest.db";//数据库名称
    public static final String TABLE_NAME = "Orders";//表的名称

    public MySqliteHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
}
    @Override
    public void onCreate(SQLiteDatabase db) {
        //初始化数据表，可以再这里面对多个表进行处理
        String sql = "create table if not exists " + TABLE_NAME + " ( calculate text)";
        db.execSQL(sql);
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        String sql = "DROP TABLE IF EXISTS " + TABLE_NAME;
        db.execSQL(sql);
        onCreate(db);
    }
}
